namespace OpenComposite.Inbox.Forms.SelfService
{
	using System;
	using System.Collections;
	using System.ComponentModel;
	using System.Data;
	using System.Drawing;
	using System.Windows.Forms;

	/// <summary>
	/// Base class for self service forms.
	/// </summary>
	public class FormBase : System.Windows.Forms.Form
	{
		#region Initialization

		public FormBase()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();
		}

		#endregion Initialization

		#region Protected Members

		#region Fields

		protected DataSet m_dataSet;
		protected Hashtable m_values = new Hashtable();
		private Label lblSep1;
		protected System.Windows.Forms.ToolStrip toolBar1;

		#endregion Fields

		#region Methods

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose(bool disposing)
		{
			if ( disposing ) {
				if ( components != null ) {
					components.Dispose();
				}
			}
			base.Dispose(disposing);
		}

		protected virtual bool SaveAndExit()
		{
			return true;
		}

		#endregion Methods

		#endregion Protected Members

		#region Private Members

		#region Fields

		private System.ComponentModel.IContainer components;
		private System.Windows.Forms.ToolStripButton toolBarButtonSaveAndExit;

		#endregion Fields

		#region Event Handlers

		private void toolBarButtonSaveAndExit_Click(object sender, EventArgs e)
		{
			if ( SaveAndExit() ) {
				this.DialogResult = DialogResult.OK;
				this.Close();
			}
		}

		#endregion Event Handlers

		#region Methods

		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.components = new System.ComponentModel.Container();
			this.toolBar1 = new System.Windows.Forms.ToolStrip();
			this.toolBarButtonSaveAndExit = new System.Windows.Forms.ToolStripButton();
			this.lblSep1 = new System.Windows.Forms.Label();
			this.toolBar1.SuspendLayout();
			this.SuspendLayout();
			// 
			// toolBar1
			// 
			this.toolBar1.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ( (byte)( 0 ) ));
			this.toolBar1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.toolBarButtonSaveAndExit});
			this.toolBar1.Location = new System.Drawing.Point(0, 0);
			this.toolBar1.Name = "toolBar1";
			this.toolBar1.Size = new System.Drawing.Size(357, 25);
			this.toolBar1.TabIndex = 0;
			// 
			// toolBarButtonSaveAndExit
			// 
			this.toolBarButtonSaveAndExit.ImageTransparentColor = System.Drawing.Color.Fuchsia;
			this.toolBarButtonSaveAndExit.Name = "toolBarButtonSaveAndExit";
			this.toolBarButtonSaveAndExit.Size = new System.Drawing.Size(76, 22);
			this.toolBarButtonSaveAndExit.Text = "Save && Close";
			this.toolBarButtonSaveAndExit.Image = OpenComposite.Inbox.Properties.Resources.png_save;
			this.toolBarButtonSaveAndExit.Click += new System.EventHandler(this.toolBarButtonSaveAndExit_Click);
			// 
			// lblSep1
			// 
			this.lblSep1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
			this.lblSep1.Dock = System.Windows.Forms.DockStyle.Top;
			this.lblSep1.Location = new System.Drawing.Point(0, 25);
			this.lblSep1.Name = "lblSep1";
			this.lblSep1.Size = new System.Drawing.Size(357, 2);
			this.lblSep1.TabIndex = 46;
			this.lblSep1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
			// 
			// FormBase
			// 
			this.ClientSize = new System.Drawing.Size(357, 298);
			this.Controls.Add(this.lblSep1);
			this.Controls.Add(this.toolBar1);
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
			this.MaximizeBox = false;
			this.MinimizeBox = false;
			this.Name = "FormBase";
			this.Text = "FormBase";
			this.toolBar1.ResumeLayout(false);
			this.toolBar1.PerformLayout();
			this.ResumeLayout(false);
			this.PerformLayout();

		}

		#endregion Methods

		#endregion Private Members
	}
}